<?php

namespace App\Http\Services;

use App\Model\CustomGame\CustomGame;
use App\Model\CustomGame\CustomGamePlayLog;
use App\Model\SystemExplain;
use Illuminate\Support\Facades\DB;

/**
 * 自定义游戏服务
 * 
 */
class CustomGameServices
{

    /**
     * 自定义游戏玩法图片类型
     */
    const CUSTOM_GAME_EXPLAIN_TYPE = 8;

    /**
     * 自定义游戏表
     *
     * @var CustomGame
     */
    protected $customGameModel;

    /**
     * 自定义游戏玩记录表
     *
     * @var CustomGamePlayLog
     */
    protected $customGamePlayLogModel;


    /**
     * 系统扩展配置
     *
     * @var SystemExplain
     */
    protected $systemExplainModel;


    public function __construct()
    {
        $this->customGameModel = new CustomGame();
        $this->customGamePlayLogModel = new CustomGamePlayLog();
        $this->systemExplainModel = new SystemExplain();
    }


    /**
     * 分页获取自定义游戏列表
     *
     * @param [type] $params
     * @return
     */
    public function getGameListByPage($params)
    {
        return $this->customGameModel->getGameListByPage($params);
    }

    /**
     * 获取一个游戏信息
     *
     * @param array $params
     * @return
     */
    public function getOneGame($params)
    {
        return $this->customGameModel->getOneGame($params);
    }

    /**
     * 保存房间游戏设置
     *
     * @param array $params
     * @return int
     */
    public function saveCustomGame($params)
    {
        return $this->customGameModel->saveCustomGame($params);
    }

    /**
     * 保存游戏玩法
     *
     * @param array $params
     * @return
     */
    public function saveRule($params)
    {
        return $this->systemExplainModel->saveRule($params);
    }

    /**
     * 获取游戏玩法规则
     *
     * @return
     */
    public function getGameRule($params)
    {
        return $this->systemExplainModel->getGameRule($params);
    }

    /**
     * 分页获取自定义游戏列表
     *
     * @param [type] $params
     * @return
     */
    public function getPlayGameListByPage($params)
    {
        return $this->customGamePlayLogModel->getPlayGameLog($params);
    }

}
